from attglobals import *

AT+CMEE=2
WAIT FOR OK

COM AT+CPBR: read phonebook entry
AT+CPBR=?
WAIT FOR OK
COM AT+CPBS: select phonebook
AT+CPBS=?
WAIT FOR OK
COM AT+CPBW: write phonebook entry
AT+CPBW=?
WAIT FOR OK
COM switch phonebook to SIM
AT+CPBS="SM"
WAIT FOR OK
COM Fill book with some stupid entries...
MESSAGE ATTENTION! Script will overwrite SIM Phonebook Indices 50...60. Continue?!
AT+CPBW=50,022199999,129,"No Connection"
WAIT FOR OK
AT+CPBW=51,492842950,145,"SIEMENS KLF"
WAIT FOR OK
AT+CPBW=52,49284254321, 145,"Invalid Number"
WAIT FOR OK
COM Verify entry no. 50
AT+CPBR=50
WAIT FOR +CPBR: 50,"022199999",129,"No Connection"
COM Verify entry no. 51
AT+CPBR=51
WAIT FOR +CPBR: 51,"+492842950",145,"SIEMENS KLF"
COM Verify entry no. 52
AT+CPBR=52
WAIT FOR +CPBR: 52,"+49284254321",145,"Invalid Number"
COM VERIFY RANGE 50..55 and wait for last expected entry
AT+CPBR=50,55
WAIT FOR +CPBR: 52,"+49284254321",145,"Invalid Number"
COM try to write with read command
AT+CPBR=50, "sfjhdg"
WAIT FOR ERROR
COM try to read with write command
AT+CPBW?
WAIT FOR ERROR
COM try invalid write command
AT+CPBW=55,423,"invalid"
WAIT FOR ERROR
COM Dial a number and read it out of last-dialled book
ATD0284299999;
WAIT FOR ATD
WAIT 5000
COM Hang up
ATH
WAIT FOR OK
COM Last-dialled book now should contain entry 0284299999
AT+CPBS="LD"
WAIT FOR OK
AT+CPBR=1,100
WAIT FOR 0284299999
COM Switch back to SIM phonebool
AT+CPBS="SM"
WAIT FOR OK
COM try to write entry with maximum lengths of number and name
AT+CPBW=55,1253453456789012345678951356765562133454,129,"ABCDEFGHIJKL"
WAIT FOR OK
COM try to write entry with phone number length exceeding limit of 20
AT+CPBW=55,12534534567890123456789513567655621334547,129,"ABCDEFGHIJKLMNOPQR"
WAIT FOR ERROR
COM try to write entry with name length exceeding limit of 18
AT+CPBW=55,1253453456789012345678951356765562133454,129,"ABCDEFGHIJKLMNOPQRX"
WAIT FOR ERROR
COM delete entry 50
AT+CPBW=50
WAIT FOR OK

